<?php
	 header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
     header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
     header ("Cache-Control: no-cache, must-revalidate");
     header ("Pragma: no-cache");
     
     header("content-type: application/x-javascript; charset=tis-620");
    
     $data=$_GET['data'];
     $cityid=$_GET['val'];
     
     
$dbhost = "localhost";
$dbuser = "root";
$dbpass = "";
$dbname    = "virtualgroupdb";
$my_db_link = mysql_connect($dbhost, $dbuser, $dbpass)
or Die("could'nt connect to my sql database");
$select_database = mysql_select_db($dbname, $my_db_link)
or Die("could'nt select database");
  
if ($data=='cityname') {  // first dropdown
          echo "<select name='cityname' onChange=\"dochange('location', this.value)\">\n";
          echo "<option value='0'>==== choose city ====</option>\n";
          $result=mysql_query("select `cityid`, `cityname` from citylist ");
		  
          while(list($cityid, $cityname)=mysql_fetch_array($result)){
               echo "<option value=\"$cityid\" >$cityname</option> \n" ;
          }
     }else if ($data=='locationdata') { // second dropdown
			$datavalue = "";
          $datavalue.= "<select name='location' >\n";
		  //echo $datavalue;
          $datavalue.= "<option value='0'>=== choose area ===</option>\n"; 
			
			
          $result=mysql_query("SELECT cl.localityid,cl.locality
FROM city_locality cl
WHERE cl.cityid ='$cityid' " );
          while(list($localityid, $locality)=mysql_fetch_array($result)){       
               $datavalue.= "<option value='$localityid'>$locality</option> \n" ;
			   
          }
		  
		 // $datavalue.= "</select>\n";
     }
	 //print 111;
      echo $datavalue;
?>